package aa.db;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebServlet("/scan")
public class QRCodeScannerServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String table_id = request.getParameter("table_id");
        if (table_id != null && !table_id.isEmpty()) {
            HttpSession session = request.getSession();
            session.setAttribute("table_id", table_id);
            response.sendRedirect("user.jsp"); // 重定向到点餐系统的首页
        } else {
            response.sendRedirect("error.jsp"); // 如果没有找到桌号，重定向到错误页面
        }
    }
}